home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / swapcom.zip / SWAPCOM.ASM < prev    next >
Assembly Source File  |  1989-03-19  |  1KB  |  42 lines

  1.  
  2. ; What this program does:
  3. ; ----------------------
  4. ;
  5. ; SWAPCOM.COM swaps the I/O port numbers for COM1 and COM2. After running
  6. ; the first time, DOS will use COM2 when COM1 is specified, and COM1 when
  7. ; COM2 is specified. Subsequent invokations reverse the existing situation.
  8. ;
  9. ; Motivation for using this program:
  10. ; ---------------------------------
  11. ;
  12. ;    If you have two modems connected to your machine, and would rather
  13. ;    not switch cables when you wish for the AUX device to be COM2
  14. ;    instead of COM1, then you will want to use this program. You can
  15. ;    automate the switching back in forth in a batch file, for instance.
  16. ;
  17. ; The source code for the program:
  18. ; -------------------------------
  19. ;
  20. BIOSarea    EQU    040h    ; segment where the BIOS Data Area lives
  21. COMPoffs    EQU    000h    ; offset into BIOS Data Area where the COMx
  22.                 ; port numbers are stored
  23. CSEG    SEGMENT
  24.     ASSUME CS:CSEG, DS:NOTHING
  25. ;
  26.     ORG    100h        ; use .COM memory layout
  27. ;
  28. START:    mov    AX, BIOSarea    ; load value of data Segment
  29.     mov    DS, AX        ; set data Segment to 0040h
  30.     mov    SI, COMPoffs    ; DS:SI will point to BIOS COM port data
  31.     mov    AX, [SI]    ; get COM1 port address
  32.     mov    BX, [SI+2]    ; get COM2 port address
  33.     xchg    AX, BX        ; exchange register contents
  34.     mov    [SI], AX    ; put COM2 address in place of COM1
  35.     mov    [SI+2], BX    ; put COM1 address in place of COM2
  36.     mov    AX, 4C00h
  37.     int    21h        ; exit with return code 00 to show no error
  38. ;
  39. CSEG    ENDS
  40. ;
  41.     END    START
  42.